<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>PDF背景提取器</title>
    <link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
    <div class="container">
        <!-- 头部 -->
        <header class="header">
            <h1>📄 PDF背景提取器</h1>
            <p>提取PDF的纯背景，去除所有文字和图片</p>
        </header>

        <!-- 上传区域 -->
        <div class="upload-section">
            <input type="file" id="pdfInput" accept=".pdf" style="display: none;">
            <button class="upload-btn" onclick="document.getElementById('pdfInput').click()">
                📤 上传PDF文件
            </button>
            <div id="fileName" class="file-name"></div>
        </div>

        <!-- 工具栏 -->
        <div class="toolbar" id="toolbar" style="display: none;">
            <div class="toolbar-left">
                <span id="pageInfo">页面: 1 / 1</span>
            </div>
            <div class="toolbar-center">
                <button class="btn" id="prevPage">◀ 上一页</button>
                <button class="btn" id="nextPage">下一页 ▶</button>
            </div>
            <div class="toolbar-right">
                <button class="btn btn-primary" id="downloadBtn">💾 下载纯背景PDF</button>
                <button class="btn btn-secondary" id="resetBtn">🔄 重新上传</button>
            </div>
        </div>

        <!-- 背景预览区域 -->
        <div class="viewer-container" id="viewerContainer">
            <div class="welcome" id="welcome">
                <div class="welcome-icon">🎨</div>
                <h2>欢迎使用PDF背景提取器</h2>
                <p>上传PDF文件，自动提取纯背景（去除文字和图片）</p>
                <ul class="features">
                    <li>✅ 自动识别并移除所有文字</li>
                    <li>✅ 自动识别并移除所有图片</li>
                    <li>✅ 智能填充背景色</li>
                    <li>✅ 导出纯背景PDF</li>
                </ul>
            </div>
            <div class="page-viewer" id="pageViewer" style="display: none;"></div>
        </div>

        <!-- 加载提示 -->
        <div class="loading-overlay" id="loadingOverlay" style="display: none;">
            <div class="loading-content">
                <div class="spinner"></div>
                <p id="loadingMessage">处理中...</p>
            </div>
        </div>

        <!-- 统计信息 -->
        <div class="stats" id="stats" style="display: none;">
            <div class="stat-item">
                <span class="stat-label">文字区域:</span>
                <span class="stat-value" id="textCount">0</span>
            </div>
            <div class="stat-item">
                <span class="stat-label">图片区域:</span>
                <span class="stat-value" id="imageCount">0</span>
            </div>
        </div>
    </div>

    <script src="/static/js/viewer.js"></script>
</body>
</html>
